#!/usr/bin/env python3


## globals
wiktFile = '/gscratch/comdata/users/kaylea/taboo/raw_data/kaikki.org-dictionary-English.json'
cleanWiktFile = '/gscratch/comdata/users/kaylea/taboo/raw_data/wiktionary_clean.json'

#Load up a wikt.words file
with open (cleanWiktFile, 'w') as outfile:
    outfile.write('[')
    i = ''
    with open (wiktFile, 'r') as fh: #Turn it into a proper json
        for item in fh:
            if i != '':
                outfile.write(i) #print the previous item
                outfile.write(',\n') #print a comma then newline
            i = item.rstrip()
    outfile.write(i) #print final entry
    outfile.write(']\n') #save

